# contain characters that are interpreted as special regexp characters.
#
# Revision 1.7 1999/08/05 15:46:29 bmah
# Fix seditpgp key-changing button label code (update properly when
# user changes her key or changes the PGP version).
#
# Revision 1.6 1999/08/04 22:43:39 cwg
# Got passphrase timeout to work yet again
#
# Revision 1.5 1999/08/04 00:21:57 iko
# Fix multiple Mime-Version: with pgp signed messages
#
# Revision 1.4 1999/08/03 18:06:43 bmah
# Permit user to cancel selection of a private key for signing (affects
# the "Choose Key..." dialog in sedit and the button at the bottom of the
# pgpsedit window).
#
# Revision 1.3 1999/08/03 16:31:43 cwg
# Display the body of a message which fails to be decoded by PGP.
#
# Revision 1.2 1999/08/03 04:05:55 bmah
# Merge support for PGP2/PGP5/GPG from multipgp branch.
#
# Revision 1.8 1999/05/06 15:36:41 cwg
# If there's a PGP error while processing the message, show the message raw.
#
# Revision 1.7 1999/05/05 14:58:10 cwg
# Modifed Jan Peterson's code to make better use of screen real estate.
#
# Revision 1.6 1999/04/30 19:09:00 cwg
# Jan Peterson's multiple PGP key patch
#
# Revision 1.5 1999/04/20 21:46:17 cwg
# Is CVS working now?
#
# Revision 1.4 1999/04/15 23:41:59 cwg
# Make the crypt menu values be per-window instead of global.
#
# Revision 1.3 1999/03/29 20:49:20 cwg
# If doing a plain signature, disable usage of the pgp(mime) flag.
#
# Revision 1.2 1999/03/26 08:41:55 cwg
# Changes to PGP interface to use preferences variables instead of
# message headers. Also, reorganize the "PGP..." menu and rename it
# "Crypt..."
#
# See the "PGP interface" preferences page for more info.
#
# Revision 1.1 1998/05/05 17:55:37 welch
# Initial revision
#
# Revision 1.1 1998/05/05 17:42:59 welch
# Initial revision
#
# Revision 1.16 1998/01/22 00:47:01 bwelch
# Fixed Pgp_Setup to use /dev/tty instead of /dev/console
#
# Revision 1.15 1997/12/22 20:53:46 bwelch
# File_Delete
#
# Revision 1.14 1997/07/25 17:14:09 bwelch
# Trapped error messages from PGP xterms.
#
# Revision 1.13 1997/07/12 23:06:28 bwelch
# Added expecttk support for PGP handling.
# Fixed recursive failures with some PGP messages.
#
# Revision 1.12 1997/06/03 18:37:00 bwelch
# Added doinc flag to Inc_Presort
# Major cleanup
#
# Revision 1.11 1997/01/25 06:21:16 bwelch
# Added Quote module support
#
# Revision 1.10 1997/01/25 05:34:08 bwelch
# Added Pgp_GetTextAttributes
# Changed display of PGP messages
#
# Revision 1.9 1996/12/21 00:58:08 bwelch
# Fixed PGP menu to support both email and www key fetching.
# Guard against missing signature parts in multipart/signed
#
# Revision 1.8 1996/12/02 21:11:11 bwelch
# Moved New Key button to be inside the help documents.
#
# Revision 1.7 1996/12/01 20:16:47 bwelch
# Added mutipart/security support.
# (Ben Escoto and Chris Garrigues)
#
# Revision 1.6 1996/03/22 18:44:34 bwelch
# Changed graphic part separator size in PGP from 5 to 6 to avoid
# downloading a new font for this case.
#
# Revision 1.5 1995/09/28 04:11:10 bwelch
# Fixed "hasfcc" check in PGP.
#
# Revision 1.4 1995/06/30 18:32:40 bwelch
# Upcase PGP mail headers
#
# Revision 1.3 1995/06/09 20:57:06 bwelch
# Added ChoosePrivateKey
#
# Revision 1.2 1995/05/24 06:01:38 bwelch
# Added Pgp_SetMyName to choose private key name
#
# Revision 1.1 1995/05/24 01:48:03 bwelch
# Initial revision
#
# Revision 1.21 1995/04/15 18:17:01 welch
# Introduced msg(path)
#
# Revision 1.20 1995/03/22 22:17:30 welch
# Changed exmh.PGP.help to help.PGP
#
# Revision 1.19 1995/03/22 18:53:52 welch
# More new code from Stefan
#
# Revision 1.1 1994/12/17 20:18:49 monnier
# Initial revision
#
# Setup is invoked by the "Make Key" button on the PGP Setup Help page
# It searches for versions on the system, which are supported by exmh.
# Setup then configures the version found on your system.
#
# If there are more than one version found on the system,
# then a dialog box pops up and asks the user for the version, he/she wants
# to configure.
# She/He can choose her/his preferred version(s).
#
proc Pgp_Setup {} {
global env pgp
Pgp_SetPath
foreach v $pgp(supportedversions) {
foreach path [split $env(PATH) ":"] {
if [file executable "$path/[set pgp($v,executable,key)]"] {
lappend installed $v
break
}
}
}
# Nothing installed
if {![info exists installed]} {
tk_messageBox -type ok -title "PGP Setup" -icon error \
-message "A PGP executable is not in your PATH. You'll have to find it (or install it) before I can do anything for you."
return
}
# dialog box, if more than one version found
if { [llength $installed] >= 2 } {
if [winfo exists .hugo] {
return
}
set t [toplevel .hugo]
wm title $t "Which version?"
wm resizable $t 0 0
set f [frame $t.frame1]
pack $f -side top
set l [label $f.pic -bitmap questhead]
pack $l -side left -padx 5
set m [message $f.msg -justify left -text \
"There are more than one versions installed on your system. Which version(s) do
you want to use to generate your key?"]
pack $m -side left
set f [frame $t.frame2]
pack $f -side top
global value
foreach v $installed {
set value($v) 0
set c [checkbutton $f.$v -variable value($v) -text [set pgp($v,fullName)] ]
pack $c -side left
}
set b [button $f.ok -text OK -command [list destroy $t] ]
pack $b -side left
tkwait window $t
foreach v $installed {
if {[set value($v)]} {
lappend wantToInstall $v
}
}
if {![info exists wantToInstall]} {
return
}
} else {
set wantToInstall $installed
}
foreach v $wantToInstall {
# setup directory
catch { exec mkdir [set pgp($v,defaultPath)] }
# setup config file
catch { exec touch [set pgp($v,configFile)] }
# make the key pair(s) and self sign it/them
if [catch {
exec xterm -title "[set pgp($v,fullName)] Setup" -e sh \
-c [set pgp($v,keyGenCmd)] >& /dev/tty } error] {
tk_messageBox -title "[set pgp($v,fullName)] Setup Error" -type ok \
-icon error -message "An error occurred while trying to generate your key: \n$error\n please try these commands at your unix shell to generate your key and self sign it: \n[set pgp($v,keyGenCmd)]\n Then restart exmh to enable its [set pgp($v,fullName)] support."
return
}
# init the support if necessary
if {![set pgp($v,enabled)]} {
Pgp_Init
} else {
set pgp($v,privatekeys) [Pgp_Exec_KeyList $v $pgp($v,ownPattern) Sec]
}
# something todo after keygeneration, send to keyserver ?
if {[info exists pgp($v,afterKeyGen)]} {
eval [set pgp($v,afterKeyGen)]
}
}
}
proc Pgp_Help {} {
Help PGP ;# Make Key button is embedded in the HTML